package cn.jetpiece.cloud.system.dp.app.utils;

import cn.jetpiece.cloud.core.util.HttpContext;

import javax.servlet.http.HttpServletRequest;

/**
 * @ProjectName: jetpiece-system-bpm
 * @ClassName: cn.jetpiece.cloud.system.dp.app.utils.HttpReqUtils
 */
public class HttpReqUtils {

    public static final String KEY_SYSTEM = "/datapipeline";

    public static String addServletPath() {
        HttpServletRequest request = HttpContext.getRequest();
        return KEY_SYSTEM + request.getServletPath();
    }

    public static String addPrefix(String path) {
        return KEY_SYSTEM + path;
    }

    public static String subServletPath() {
        HttpServletRequest request = HttpContext.getRequest();
        return request.getServletPath().replaceAll(KEY_SYSTEM,"");
    }
}